package com.ps.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.github.pagehelper.Page;
import com.ps.dto.SetmealPageQueryDTO;
import com.ps.entity.Setmeal;
import com.ps.vo.MedicineItemVO;
import com.ps.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import java.util.List;

@Mapper
public interface SetmealMapper extends  BaseMapper<Setmeal> {
    Page<SetmealVO> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO);

    @Select("select sd.name, sd.copies, d.image, d.description " +
            "from setmeal_medicine sd left join medicine d on sd.medicine_id = d.id " +
            "where sd.setmeal_id = #{setmealId}")
    List<MedicineItemVO> getMedicineItemBySetmealId(Long setmealId);

}
